﻿@{
    ViewBag.Title = "菜肴选择";
    Layout = "~/Views/Shared/_LayoutList.cshtml"; 
}
@(       
 Html.DWZGridFor<Resto.CostControl.Core.Dish>()
    .ID("gridList")
    .Action(@Url.Action("MultipleDishList"))
    .Height("document.documentElement.clientHeight-86")
    .Columns(col =>
    {
        col.Bind(e => e.Id).IsKey();
        col.Bind(e => e.Code).Width(60).AsQuery().Align(FlexiGridAlign.Left);
        col.Bind(e => e.Name).Width(80).AsQuery().Align(FlexiGridAlign.Left);
        col.Bind(e => e.Category).EnumKey("DishType").Width(80);
        col.Bind(e => e.MainMaterialType).EnumKey("MaterialCategory").Width(80);
        col.Bind(e => e.Cost).Width(80).Align(FlexiGridAlign.Right);
        col.Bind(e => e.Price).Width(80).Align(FlexiGridAlign.Right);
        col.Bind(e => e.CookType).EnumKey("CookType").Width(80);
    })
    .Buttons(btn =>
    {
        btn.Bind("选择", FlexiGridButtonType.Add).OnPress("Selected");
    })
)
<script type="text/javascript">
    function Selected() {
        if ($("#gridList").getSelectedRows().length == 0) {
            alert("请选择一条记录");
        }
        var date = $("#gridList").getSelectedRows();
        CloseModalDialog(null, true, date);
    }
</script>
